SCFormField = sCore.makeClass(Component,{
    init : function() {
        SCFormField.parentClass.init.apply(this,arguments);
        sCore.initChildInstances(this,'validators');
    },
    create : function() {
        SCFormField.parentClass.create.apply(this,arguments);
    },

    validate : function() {
        var i;
        if ($.isEmptyObject(vals = this.validators)) return true;
        for (i in vals)
            if (!vals[i].validate()) {
                this._failedValidator = vals[i];
                return false;
            }
        return true;
    },
    getValue : function() {
        switch (this.type) {
            case this.TYPE_RADIO:
            case this.TYPE_CHECKBOX:
                var val = [];
                this.$().filter(":checked").each(function(){
                    val.push($(this).val());
                });
                return val;
                break;
        }
        return this.$().val();
    },
    collectPost : function(args) {
        SCFormField.parentClass.collectPost.apply(this,arguments);
        args[this.getControlFullName()] = this.getValue();
    }
});
FormField = sCore.makeClass(SCFormField,{});